package com.digitalchina.lxnsy.viewholder;

import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.digitalchina.lxnsy.R;
import com.digitalchina.lxnsy.entity.ProductStandardVO;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;

/**
 * ================================================
 * 项目名称：BigData
 * 类描述：
 * 包名：com.digitalchina.bigdata.viewholder
 * 创建人：郑皓
 * 创建时间：2018/8/21 11:10
 * 修改备注：
 * ================================================
 */

public class SelectProductionHolder extends BaseViewHolder<ProductStandardVO> {


    private TextView tvName;
    private ImageView ivCheck;
    private ImageView ivBg;


    public SelectProductionHolder(ViewGroup parent) {
        super(parent, R.layout.item_select_production);
        tvName = $(R.id.tv_name);
        ivCheck = $(R.id.iv_check);
        ivBg = $(R.id.iv_bg);
    }

    @Override
    public void setData(ProductStandardVO data) {
        super.setData(data);

        tvName.setText(data.getName() + "");

        if (data.isChecked())
            ivCheck.setImageResource(R.drawable.ic_check_t);
        else
            ivCheck.setImageResource(R.drawable.ic_check_f);


        switch (getAdapterPosition() % 3) {
            case 0:
                ivBg.setBackgroundResource(R.drawable.bg_select_production1);
                break;
            case 1:
                ivBg.setBackgroundResource(R.drawable.bg_select_production2);
                break;
            case 2:
                ivBg.setBackgroundResource(R.drawable.bg_select_production3);
                break;
        }
    }

}
